package compte;

public class Operation {
	protected String devise ;
	protected Q amount ;
	protected String memo ;
	protected String category ;
	protected String num ;
	protected String payee ;
	protected int year ;
	protected int month ;
	protected int day ;
	Operation(Q theAmount, String theDevise, String theMemo, String theCategory, String theNum, String thePayee, int theYear, int theMonth, int theDay){
		devise = theDevise ;
		amount = theAmount ;
		memo = theMemo ;
		category = theCategory ;
		num = theNum ;
		payee = thePayee ;
		year = theYear ;
		month = theMonth ;
		day = theDay ;

	}
	void AddInTheDom (Dom theDom){
		theDom.Add10Elts("Ope", 
				"memo", memo,
				"category", category,
				"num", num,
				"payee", payee,
				"amountNum", new Long(amount.getNum()).toString(), 
				"amountDen", new Long( amount.getDen()).toString(),
				"devise",  devise,
				"year", new Integer(year).toString(), 
				"month", new Integer ( month).toString(), 
				"day", new Integer (day).toString() );   
	}  
	
	boolean equals(Operation op2){
		if (day != op2.day) return false ;
		if (month != op2.month) return false ;
		if (year != op2.year) return false ;
		if (!amount.equals(op2.amount) ) return false ;
		if (memo != op2.memo ) return false ; 
		return true ;
	}  
	public void UpdateStats(Stats stats) {
		stats.Update("Payee", payee, year, month, amount) ;
	}
}
